package com.bba.manager.sku.controller;

import com.bba.manager.common.model.sku.Parts;
import com.bba.manager.common.model.sku.Series;
import com.bba.manager.common.util.ResponseVO;
import com.bba.manager.sku.service.impl.PartsServiceImpl;
import com.bba.manager.sku.service.impl.SeriesServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author SYANDZZY
 * @since 2025-08-12
 */
@RestController
@RequestMapping("/series")
public class SeriesController {
    @Autowired
    private SeriesServiceImpl seriesService;
    @PostMapping("/add")
    public ResponseVO add(Series series){
        return ResponseVO.success(seriesService.save(series));
    }
    @DeleteMapping("/deleted")
    public ResponseVO deleted(Long id){
        return ResponseVO.success(seriesService.removeById(id));
    }
    @PostMapping("/update")
    public  ResponseVO update(Series series){
        return ResponseVO.success(seriesService.updateById(series));
    }
    @GetMapping("/getone")
    public ResponseVO getone(Long id){
        return ResponseVO.success(seriesService.getById(id));
    }
    @GetMapping("/getall")
    public ResponseVO getall(){
        return ResponseVO.success(seriesService.list());
    }

}
